package com.example.ccj.b.c.dialogxy.impl;

import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.view.animation.LinearInterpolator;

import com.example.ccj.R;
import com.example.ccj.b.c.custom.image.ShowBigImageChangeListener;
import com.example.ccj.b.c.custom.image.MLocalMedia;
import com.example.ccj.b.c.custom.image.ShowBigPictureControl;
import com.example.ccj.b.c.dialogxy.IDialog;
import com.example.ccj.b.c.dialogxy.SYDialog;
import java.util.List;

/**
 * 大图展示dialog
 */
public class DialogShowBigPicture extends SYDialog.Builder {
    ShowBigPictureControl control;
    public DialogShowBigPicture(Context context) {
        super(context);
        setDialogView(R.layout.dialog_show_big_picture);
        setCancelable(true);//点击是否可关闭
        setScreenHeightP(1);//高度比例
        setScreenWidthP(1);//宽度比例
        setWindowBackground(Color.WHITE);
        setRemovePerDialog(false);   //是否移除前一个dialog
        setBuildChildListener(new IDialog.OnBuildListener() {
            @Override
            public void onBuildChildView(IDialog dialog, View parent, int layoutRes) {
                control = parent.findViewById(R.id.dialog_show_big_picture_control);
                control.setMode(showMode)
                        .setData(imageList)
                        .setImageChangeListenear(imageChangeListener)
                        .show();
            }
        });
    }


    List<MLocalMedia> imageList;

    public DialogShowBigPicture setData(List<MLocalMedia> imageList){
        this.imageList = imageList;
        return this;
    }

    int showMode;
    public DialogShowBigPicture setImageChangeListener(int showMode){
        this.showMode = showMode;
        return this;
    }

    ShowBigImageChangeListener imageChangeListener;

    public DialogShowBigPicture setImageChangeListener(ShowBigImageChangeListener imageChangeListener){
        this.imageChangeListener = imageChangeListener;
        setOnDismissListener(new IDialog.OnDismissListener() {
            @Override
            public void onDismiss(IDialog dialog) {
                imageChangeListener.over(control);
            }
        });
        return this;
    }






    @Override
    public SYDialog show() {
        return super.show();
    }
}
